package com.atgouwu.mall.common.exception;

import lombok.Data;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper = true)
@Data
public class MyException extends RuntimeException {

    private Integer code;
    private String message;

    public MyException(String message) {
        this.message = message;
    }

    public MyException(String message, Integer code) {
        this.message = message;
        this.code = code;
    }

    public MyException(String message, Integer code, Throwable cause) {
        super(cause);
        this.message = message;
        this.code = code;
    }

    public MyException(ResultEnum resultEnum) {
        this.message = resultEnum.getMessage();
        this.code = resultEnum.getCode();
    }

    public MyException(ResultEnum resultEnum, Throwable cause) {
        super(cause);
        this.message = resultEnum.getMessage();
        this.code = resultEnum.getCode();
    }

}
